<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!--DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
	
</style>
<script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/js/datePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/js/heaq/pcasunzip.js"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/jquery-1.4.1.js" type="text/javascript"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/formValidator.js" type="text/javascript" charset="UTF-8"></script>
<script language="javascript" src="<%=request.getContextPath()%>/js/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/validator.css">
<script>
$(document).ready(function(){
	

	function showRegionValid()
	{
		if ($("#area").val() != $("#area>option").first().val())
		{
			$("#forRegion").val("true");
		}
		else
		{
			$("#forRegion").val("true");
		}
		//$.formValidator.showMessage($.formValidator.oneIsValid("forRegion",1));
	}
	
	$("#province").change(function(){showRegionValid();});
	$("#city").change(function(){showRegionValid();});
	$("#area").change(function(){showRegionValid();});

	function caseHistoryTimesValid()
	{
		if ($.formValidator.isOneValid("caseHistoryCreateTime") && $.formValidator.isOneValid("caseHistoryUpdateTime"))
		{
			$("#caseHistoryTimes").val($("#caseHistoryUpdateTime").val());
		}
		else
		{
			$("#caseHistoryTimes").val($("#caseHistoryCreateTime").val());
		}

		if ($.formValidator.isOneValid("caseHistoryTimes"))
		{
			$("#caseHistoryTimesTip").css("display","none");
		}
		else
		{
			$("#caseHistoryTimesTip").css("display","inline");
		}

		$.formValidator.showMessage($.formValidator.oneIsValid("caseHistoryTimes",1));
	}

	//onchange事件被插件占用 拿mouseover凑合凑合，效果很不理想
	$("input").mouseover(function(){caseHistoryTimesValid();});
	
	$.formValidator.initConfig({formid:"actionForm",onerror:function(){alert("校验没有通过，具体错误请看错误提示")}});

	$("#patientName")
		.formValidator({onshow:"请输入患者姓名",onfocus:"请输入患者的真实姓名",oncorrect:"感谢您的配合"})
		.inputValidator({min:1,onerror:"患者姓名不能为空,请确认"});

	$("#patientRelation")
		.formValidator({onshow:"请输入患者民族",onfocus:"请输入患者的真实民族",oncorrect:"感谢您的配合"})
		.inputValidator({min:1,onerror:"患者民族不能为空,请确认"});

	$("#patientCardID")
		.formValidator({onshow:"请输入患者身份证号",onfocus:"患者身份证号不能为空",oncorrect:"感谢您的配合"})
		.inputValidator({min:1,onerror:"患者身份证号不能为空,请确认"})
		.regexValidator({regexp:"idcard",datatype:"enum",onerror:"你输入的患者身份证号不符合规范"});

	$("#patientAge")
		.formValidator({onshow:"请输入患者年龄",onfocus:"患者年龄不能为空",oncorrect:"感谢您的配合"})
		.inputValidator({min:1,onerror:"患者年龄不能为空,请确认"})
		.regexValidator({regexp:"num1",datatype:"enum",onerror:"你输入的患者年龄不符合规范"});

	$("#patientJob")
		.formValidator({onshow:"请输入患者职业",onfocus:"患者职业不能为空",oncorrect:"感谢您的配合"})
		.inputValidator({min:1,onerror:"患者职业不能为空,请确认"});

	//$("#forRegion")
	//	.formValidator({onshow:"请输选择患者住址",onfocus:"",oncorrect:"感谢您的配合"})
		//.inputValidator({min:1,onerror:"请输选择患者住址,请确认"});

	$("#caseHistoryCreateTime")
		.formValidator({onshow:"请输入患者首次入院时间",onfocus:"患者首次入院时间不能为空",oncorrect:"感谢您的配合"})
		.inputValidator({min:1,onerror:"患者首次入院时间不能为空,请确认"})
		.regexValidator({regexp:"date",datatype:"enum",onerror:"你输入的患者首次入院时间不符合规范"});

	$("#caseHistoryUpdateTime")
		.formValidator({onshow:"请输入患者本次入院时间",onfocus:"患者本次入院时间不能为空",oncorrect:"感谢您的配合"})
		.inputValidator({min:1,onerror:"患者本次入院时间不能为空,请确认"})
		.regexValidator({regexp:"date",datatype:"enum",onerror:"你输入的患者本次入院时间不符合规范"})

	$("#caseHistoryTimes")
		.formValidator({onshow:"",onfocus:"本次入院时间不得早于首次入院时间,请确认",oncorrect:"0"})
		.compareValidator({desid:"caseHistoryCreateTime",operateor:">=",onerror:"本次入院时间不得早于首次入院时间,请确认"});
});

</script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/heaq/pas.css">
</head>
<body id="new"  >

<div id="breadcrumb"><a href="#">首页</a> 〉 新建病历</div>

<div id="content" style="position:absolute;" >
  <div id="newInfo">
    <div class="module"> 
      <h2>新建病历</h2>
      <form name="actionForm" method="post" action="operateAction.action" id="actionForm">
        <input type="hidden" value="name" name="logColumn" /> 
	    <input type="hidden" value="true" name="islog" /> 
        <input type="hidden" name="code" value="004001"> 
	    <input type="hidden" name="imitateStep" value="managerCaseHistoryMain_1">
	    <input type="hidden" name="directFile" id="directFile" value="forwardAction.action?code=005">
		<input type="hidden" name="paramMap.stepReloadType" id="stepReloadType" value="100">
      <ul class="newInfoList">
        <li  >
          <label>病人姓名</label>
          <input type="text"  name="paramMap.patientName" id="patientName"/>&nbsp;<font color="red">*</font><span id="patientNameTip" style="width:250px"></span>
        </li>
        <li>
          <label>性别</label>
          <select name="paramMap.patientGender">
            <option value="1">男</option>
            <option value="2">女</option>
            <option value="3">未知</option>
          </select>
        </li>
        <li>
          <label>民族</label>
          <input name="paramMap.patientRelation" id="patientRelation" type="text" size="12" />
          &nbsp;<font color="red">*</font><span id="patientRelationTip" style="width:250px"></span>
        </li>
        <li>
          <label>身份证号</label>
          <input name="paramMap.patientCardID" id="patientCardID" type="text" size="36" maxlength="18" />
          &nbsp;<font color="red">*</font><span id="patientCardIDTip" style="width:250px"></span>
        </li>
        <li>
          <label>年龄</label>
          <input name="paramMap.patientAge" id="patientAge" type="text" />
           &nbsp;<font color="red">*</font><span id="patientAgeTip" style="width:250px"></span>
        </li>
        <li>
          <label>职业</label>
          <input name="paramMap.patientJob" id="patientJob" type="text" />
          &nbsp;<font color="red">*</font><span id="patientJobTip" style="width:250px"></span>
        </li>
        <li>
          <label>婚姻状况</label>
          <select name="paramMap.MaritalStatus" >
            <option value="0">已婚</option>
            <option value="1">未婚</option>
          </select>
        </li>
        <li>
          <label>城市及区县</label>
          <select id="province" name="paramMap.patientCity">
          </select>
          <select id="city" name="paramMap.patientDistrict">
          </select>
          <select id="area" name="paramMap.patientDetailDistrict">
          </select>
          <input type="hidden" value="" id="forRegion" /> 
          <!--   &nbsp;<font color="red">*</font><span id="forRegionTip" style="width:250px"></span>-->
        </li>
        <li>
          <label>首次入院时间</label>
          <input name="paramMap.caseHistoryCreateTime" id="caseHistoryCreateTime" type="text" />
          <img onclick="WdatePicker({el:'caseHistoryCreateTime'})" src="css/heaq/images/dateIcon.gif" alt="选择日期" />
          &nbsp;<font color="red">*</font><span id="caseHistoryCreateTimeTip" style="width:250px"></span>
       	</li>
        <li>
          <label>本次入院时间</label>
          <input name ="paramMap.caseHistoryCreateTime" id="caseHistoryUpdateTime" type="text" />
          <img onclick="WdatePicker({el:'caseHistoryUpdateTime'})" src="css/heaq/images/dateIcon.gif" alt="选择日期" />
          &nbsp;<font color="red">*</font><span id="caseHistoryUpdateTimeTip" style="width:250px"></span>
      </li>
      <li>
		<input type="hidden" value="" id="caseHistoryTimes" /> 
        <span id="caseHistoryTimesTip" style="width:250px;display:none"></span>
      </li>
      </ul>
      <div class="ctrl">
        <input type="submit" name="BtnOk" value="保存并录入医疗信息" />&nbsp;&nbsp;
        <!-- <input type="button" value="保存" />&nbsp;&nbsp; -->
        <input type="reset" name="reset" value="重置" />
      </div>
      <script language="javascript">
          new PCAS("paramMap.patientCity","paramMap.patientDistrict","paramMap.patientDetailDistrict");
          var allwidth = window.document.body.clientWidth;
          var setLeft = (allwidth - 810 )/2 ;
          document.getElementById("content").style.left=setLeft; 
          document.getElementById("content").style.top=26; 
         
      </script>
      </form>
    </div>
  </div>
</div>
</body>
</html>